<?php 
	$logo 			= TEMPLATE_URL . '/public/default/images/logo.png';

	$full_name 		= $this->formText('full_name', $this->Item['full_name']);
	$email			= $this->formText('email', $this->Item['email']);
	$title			= $this->formText('title', $this->Item['title']);
	$content		= $this->formTextarea('content', $this->Item['content']);

	$captcha 		= $this->captcha;
	$txtCaptcha 	= $this->formText('captcha','');
	$txtID 			= $this->formHidden('captchaID',$this->captcha_id);
	$urlCaptch		= $this->baseUrl('default/index/captcha-image');
	$inputCaptcha	= $this->formText('captcha',null, array('class' => 'width_240'));
	$submit			= $this->formSubmit('submitMessage', $this->translate('Send'), array('class' => 'button_large'));
?>

<div class="box-header">
                	<h3>Liên hệ</h3>
                </div>
                <div class="box-left box-contact">
                    <div class="form-contact">
                		<h2>Liên hệ</h2>
                		<form action="" method="post" name="frm-contact" id="frm-contact">
                    		<div class="box">
                        		<span class="title">Họ và tên: </span>
                     	              	<?php echo $full_name?>
	              	<?php 
	              		if(!empty($this->errors['full_name'])){
	              			echo '<div class="clr"></div><span class="errors">' . $this->errors['full_name'] . '</span>';
	              		}
	              	?>	              		  		</div>
                    		<div class="box">
                       	 		<span class="title">Email: </span>
                        			              	<?php echo $email?>
	              	<?php 
	              		if(!empty($this->errors['email'])){
	              			echo '<div class="clr"></div><span class="errors">' . $this->errors['email'] . '</span>';
	              		}
	              	?>              		          					</div>
                    		<div class="box">
                        		<span class="title">Tiêu đề: </span>
                        			               	<?php echo $title?>
								<?php 
									if(!empty($this->errors['title'])){
										echo '<div class="clr"></div><span class="errors">' . $this->errors['title'] . '</span>';
									}
								?>              		           					</div>
                    		<div class="box">
                        		<span class="title">Nội dung: </span>
                        			              	<?php echo $content?>
								<?php 
									if(!empty($this->errors['content'])){
										echo '<div class="clr"></div><span class="errors">' . $this->errors['content'] . '</span>';
									}
								?>	              		         					</div>
                    		<div class="box">
                        		<span class="title">Mã captcha: </span>
                        			<?php echo $txtCaptcha?>
								<?php 
									if(!empty($this->errors['captcha'])){
										echo '<div class="clr"></div><span class="errors">' . $this->errors['captcha'] . '</span>';
									}
								?>	              		        </div>
                    		<div class="box">
                        		<div class="border_img captcha"><?php echo $txtID . $captcha?></div>
                        		<div class="refresh" id="refresh"></div>
                    		</div>
                    		<div class="clr"></div>
                            <div class="box">
                                <a class="button" href="#"><span>Gửi mail</span></a>
                            </div>	
                 		</form>
            		</div>
                    <div class="info-contact">
                        <div class="map">
                            <div class="border_img"><div id="google_map"></div></div>
                        </div>
                        <div class="address">
                            <p class="upper" style="text-align: left;"><span style="font-size: small; color: #ff0000;"><strong>Công Ty TNHH SX TM&nbsp;THỜI TRANG CHAN'S</strong></span></p>
							<p class="upper" style="text-align: left;"><span style="font-size: small;">Địa chỉ&nbsp;: 451/15 Tô Hiến Thành , Phường 14, Quận 10, Tp Hồ Chí Minh, Việt Nam</span></p>
							<p style="text-align: left;"><span style="font-size: small;">Điện thoại: 091.721.0166</span></p>
							<p style="text-align: left;"><span style="font-size: small;">Email:&nbsp;info@chans.vn</span></p>
							<p style="text-align: left;"><span style="font-size: small;">Tên TK: Trần Tuấn Danh</span></p>
							<p style="text-align: left;"><span style="font-size: small;">STK: 4214 9456 0139 8423</span></p>
							<p style="text-align: left;"><span style="font-size: small;">Ngân hàng ACB – Chi Nhánh PGD Vạn Hạnh</span></p>
                        </div>
      				</div>
                    <div class="clr"></div>
                </div>
<script type="text/javascript" 
src="http://maps.googleapis.com/maps/api/js?sensor=false&language=en"></script>
<script type="text/javascript">
function getData(data){
	$('#frm-contact div.border_img').html(data);
	return false;
}

function refreshCaptcha(){
	var captchaID = $("#captchaID").val();
	$.get('<?php echo $urlCaptch . '/captchaID/';?>'+captchaID,getData);
}

$(document).ready(function(){
	<?php if(!empty($this->messages[0])):?>
		$('.cnt_note').text('<?php echo $this->messages[0];?>');
		$('.note_popup').slideDown(500).delay(3000).slideUp(500);
	<?php endif;?>
	
	$('#refresh').click(function(e){
		e.preventDefault();
		refreshCaptcha();

	});
	$('a.button').click(function(){
		$('#frm-contact').submit();
		return false;
	})
	initialize();
});

var map;
function initialize() {
    var myLatlng = new google.maps.LatLng(10.775955,106.663038);
    var myOptions = {
    zoom: 15,
    center: myLatlng,
    mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("google_map"), myOptions); 
var text;
//text= "<table><tr><td width='200' style='font-family: Calibri;font-size:13px;color: rgb(0, 149, 71)'><strong>LabRoots, Inc.</strong><br />18340 Yorba Linda Blvd.<br />Suite 107 PMB 427 <br />Yorba Linda, CA 92886<br />Phone: 1-714-926-6384<br />Fax: 1-714-463-4673</td></tr></table>";
text= "<table><tr><td><img style='margin-right:10px; width: 110px' src='<?php echo $logo?>'/></td></tr></table>";
   var infowindow = new google.maps.InfoWindow(
    { content: text,
        size: new google.maps.Size(100,50),
        position: myLatlng
    });
       infowindow.open(map);    
    var marker = new google.maps.Marker({
      position: myLatlng, 
      map: map,
      title:"Shopbebo"
  });
}
</script>      				